home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / TeXsource / beebe / h / charpxl < prev    next >
Encoding:
Text File  |  1990-05-18  |  1.6 KB  |  62 lines

  1. /* -*-C-*- charpxl.h */
  2. /*-->charpxl*/
  3. /**********************************************************************/
  4. /******************************* charpxl ******************************/
  5. /**********************************************************************/
  6.  
  7. #ifdef __STDC__
  8. int
  9. charpxl(BYTE c, void (*outfcn)())
  10. {
  11. #else
  12. int
  13. charpxl(c,outfcn)    /* return 0 on success, and EOF on failure */
  14. BYTE c;            /* current character value */
  15. void (*outfcn)();    /* (possibly NULL) function to output current row */
  16. {
  17. #endif
  18.     UNSIGN16 i,j;        /* loop index */
  19.     long p;            /* offset into font file */
  20.     register UNSIGN32 *q;    /* pointer into rasters area */
  21.     struct char_entry *tcharptr;/* temporary char_entry pointer */
  22.  
  23.     if ((c < FIRSTPXLCHAR) || (LASTPXLCHAR < c))
  24.     {
  25.     (void)warning(
  26.         "charpxl():  Character value out of range for PXL font file");
  27.     return(EOF);
  28.     }
  29.     tcharptr = &(fontptr->ch[c]);
  30.  
  31.     if (!VISIBLE(tcharptr))
  32.     return(0);    /* do nothing for empty characters */
  33.  
  34.     p = (long)tcharptr->fontrp;    /* font file raster pointer */
  35.     if (p < 0L)
  36.     {
  37.     (void)warning(
  38.         "charpxl():  Requested character not found in PXL font file");
  39.     return(EOF);
  40.     }
  41.  
  42.     if (FSEEK(fontfp,p,0))
  43.     {
  44.     (void)warning(
  45.         "charpxl():  FSEEK() failure for PXL font file character raster");
  46.     return(EOF);
  47.     }
  48.  
  49.     if (outfcn != (void(*)())NULL)
  50.     {
  51.     img_words = ((UNSIGN16)(tcharptr->wp) + 31) >> 5;
  52.     for (i = 0; i < (UNSIGN16)(tcharptr->hp); ++i)
  53.     {
  54.         q = img_row;
  55.         for (j = 0; j < img_words; ++j)
  56.         *q++ = (UNSIGN32)nosignex(fontfp,(BYTE)4);
  57.         (void)(*outfcn)(c,i);
  58.     }
  59.     }
  60.     return(0);
  61. }
  62.